package com.jcb.countfrench.view;


import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

import com.jcb.countfrench.MainActivity;
import com.jcb.countfrench.R;
import com.jcb.countfrench.model.Quizz;
import com.jcb.countfrench.model.User;
import com.jcb.countfrench.presenter.CountPresenter;
import com.jcb.countfrench.presenter.QuizzChoicePresenter;

public class QuizzChoiceView extends LinearLayout{
	
	Button btnQuizz01, btnQuizz02, btnQuizz03 ;
	CountPresenter presenter ;
	final MainActivity mainActivity ;
	
	public QuizzChoiceView(Context context, final MainActivity mainActivity, User user, QuizzChoicePresenter presenter) {
		super(context);
		this.mainActivity = mainActivity ;
		LayoutInflater layoutInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		layoutInflater.inflate(R.layout.quizzchoice,this);
		List<Quizz> listquizz = presenter.getListQuizz();
		
		final Quizz quizzCourant = listquizz.get(0) ;
		btnQuizz01 = (Button) findViewById(R.id.btnQuizz01);
		btnQuizz01.setText("" + listquizz.get(0).getIdQuizz());		
		btnQuizz01.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				mainActivity.displayQuizzView(quizzCourant);
			}
		}
		) ;
		
		btnQuizz02 = (Button) findViewById(R.id.btnQuizz02);
		btnQuizz02.setText("" + listquizz.get(1).getIdQuizz());		
		
		btnQuizz03 = (Button) findViewById(R.id.btnQuizz03);
		btnQuizz03.setText("" + listquizz.get(2).getIdQuizz());		
			
		
	}


	
}


